/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package leilao;

import javax.swing.JFrame;
import org.apache.commons.codec.digest.DigestUtils;

/**
 *
 * @author Camila
 */
public class ClienteDAO {

    private JFrame Leiloes;
    private ConnCliente req = new ConnCliente();

    public boolean validaLogin(String usrLogin, String pwdLogin) {
        Cliente cliente = new Cliente();
        cliente.setLogin(usrLogin);
        String passwd;
        passwd = DigestUtils.md5Hex(pwdLogin); //codifica a senha
        cliente.setSenha(passwd);
        req.conecta();
        req.setMsgCliente("@LOGIN $" + usrLogin + "$" + passwd);
        req.enviaMsg();
        passwd = req.getResponseLine();
        if (!"false".equals(passwd)) {
            if (Leiloes == null) {
                JFrame lances = new JFrame();
                lances = new TelaLances(passwd);
                lances.show();
            }
            return true;
        }
        return false;
    }
}
